﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using Telerik.Web.UI;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class TR_TrainingCoursesAddTrainee : System.Web.UI.Page
    {
        InitialData_BLL iniData = new InitialData_BLL();
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //RadGrid2.DataSource = "";
                //RadGrid2.DataBind();
                //===========================
                lblID.Text = Request.QueryString["id"];
                Session["id"] = Request.QueryString["id"];

                bindHeader();

                LoadDataGrid3();
                LoadDataGrid1();
                LoadDataGrid2();
            }
            
        }

        private void bindHeader()
        {
            //DataSet ds = new DataSet();
            //ds = iniData.ListTrainingCurriculums(lblID.Text);
            //lblName.Text = ds.Tables[0].Rows[0]["training_cur_descr"].ToString();
            //lblType.Text = ds.Tables[0].Rows[0]["training_type_descr"].ToString();
            //lblDetail.Text = ds.Tables[0].Rows[0]["details"].ToString();
        }
        
        private void LoadDataGrid3()
        {
            RadGrid3.DataSource = "";
            RadGrid3.DataBind();
            //try
            //{
            //    DataSet ListSalaryCommand = iniData.ListTrainingCurriculumsPrerequisites("", lblID.Text);
            //    DataTable table = ListSalaryCommand.Tables[0];
            //    RadGrid2.DataSource = ListSalaryCommand.Tables[0];
            //    RadGrid2.DataBind();
            //}
            //catch (Exception ex)
            //{

            //}
        }

        protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //if (e.CommandName == "Delete")
            //{
            //    int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Sequence"]);
            //    iniData.DeleteTrainingCurriculumsPrerequisites(seq);
            //}
            //if (e.CommandName == "ExpandCollapse")
            //    return;
            //LoadDataGrid();
        }

        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
            
        }


        private void LoadDataGrid1()
        {
            RadGrid1.DataSource = "";
            RadGrid1.DataBind();
            //try
            //{
            //    DataSet ListSalaryCommand = iniData.ListTrainingCurriculumsSubject("",lblID.Text);
            //    DataTable table = ListSalaryCommand.Tables[0];
            //    RadGrid1.DataSource = ListSalaryCommand.Tables[0];
            //    RadGrid1.DataBind();
            //}
            //catch (Exception ex)
            //{

            //}
        }

        protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
        //    if (e.CommandName == "Delete")
        //    {
        //        int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Sequence"]);
        //        iniData.DeleteTrainingCurriculumsSubject(seq);
        //    }
        //    if (e.CommandName == "ExpandCollapse")
        //        return;
        //    LoadDataGrid1();
        }

        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {

        }


        private void LoadDataGrid2()
        {
            RadGrid2.DataSource = "";
            RadGrid2.DataBind();
            //try
            //{
            //    DataSet ListSalaryCommand = iniData.ListTrainingCurriculumsCompare("", lblID.Text);
            //    DataTable table = ListSalaryCommand.Tables[0];
            //    RadGrid3.DataSource = ListSalaryCommand.Tables[0];
            //    RadGrid3.DataBind();
            //}
            //catch (Exception ex)
            //{

            //}
        }

        protected void RadGrid3_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
        //    if (e.CommandName == "Delete")
        //    {
        //        int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Sequence"]);
        //        iniData.DeleteTrainingCurriculumsCompare(seq);
        //    }
        //    if (e.CommandName == "ExpandCollapse")
        //        return;
        //    LoadDataGrid2();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {

        }
        protected void ddlEmployeeType_SelectedIndexChanged(object sender, EventArgs e)
        { 
        }
        protected void cb1_Checked(object sender, EventArgs e)
        { 
        }

       
    }

}
